//
//  Const.swift
//  SinaWeiBo
//
//  Created by Leon 笑 竹 on 2017/8/4.
//  Copyright © 2017年 Leon 笑 竹. All rights reserved.
//

import Foundation
import UIKit

//UIScreen

/// 屏幕宽度
let kScreenWidth = UIScreen.main.bounds.width
/// 屏幕高度
let kScreenHeight = UIScreen.main.bounds.height
/// 导航栏高度
let kNavBarHeight = 44.0;
/// 状态栏高度
let kStatusBarHeight = 20.0;
/// Tab栏高度
let kTabBarHeight = 49.0;


//通知/用户
let kNotificationCenter = NotificationCenter.default
let kUserDefaults = UserDefaults.standard

//系统版本
//判断是否为iPhone
let IS_IPHONE = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.phone)
//判断是否为iPad
let IS_IPAD = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad)
//判断是否为ipod
let IS_IPOD = (UIDevice.current.model == "iPod touch")
// 判断是否为 iPhone 5SE
let is_iPhone5SE = (UIScreen.main.bounds.width == 320.0 && UIScreen.main.bounds.height == 568.0)
// 判断是否为iPhone 6/6s
let is_iPhone6Or6s = (UIScreen.main.bounds.width == 375.0 && UIScreen.main.bounds.height == 667.0)
// 判断是否为iPhone 6Plus/6sPlus
let is_iPhone6PlusOr6sPlus = (UIScreen.main.bounds.width == 414.0 && UIScreen.main.bounds.height == 736.0)
//获取系统版本
let IOS_SYSTEM_VERSION = Float(UIDevice.current.systemVersion)!
//判断 iOS 8 或更高的系统版本
let IS_IOS_VERSION_8_OR_LATER = ((IOS_SYSTEM_VERSION >= 8.0) ? (true):(false))

//获取沙盒路径

//获取temp
let kPathTemp = NSTemporaryDirectory()
//获取沙盒 Document
let kPathDocument = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first
//获取沙盒 Cache
let kPathCache = NSSearchPathForDirectoriesInDomains(.cachesDirectory , .userDomainMask, true).first


//存储数据
func save_userDefaults(key : String,value:AnyObject?){
    
    kUserDefaults.set(value!, forKey:key)
}

//拿取数据
func load_userDefaults(key : String) -> Any{
    
   return kUserDefaults.object(forKey: key) ?? ""
    
}

